package com.example.test4;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        TextView textView_main=(TextView) findViewById(R.id.textView_main);



        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.item, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner_sex.setAdapter(adapter);

        spinner_sex.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            //当选中某一个数据项时触发该方法
            /*
             * parent接收的是被选择的数据项所属的 Spinner对象，
             * view参数接收的是显示被选择的数据项的TextView对象
             * position接收的是被选择的数据项在适配器中的位置
             * id被选择的数据项的行号
             */
            @Override
            public void onItemSelected(AdapterView<?> parent, View view,int position, long id) {
                String string_sex=spinner_sex.getSelectedItem().toString();
                if(string_sex.equals("男")){
                    button_husband.setEnabled(false);
                    button_wife.setEnabled(true);
                    textView_main.setText(" ");
                }
                if(string_sex.equals("女")){
                    button_wife.setEnabled(false);
                    button_husband.setEnabled(true);
                    textView_main.setText(" ");
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
                // TODO Auto-generated method stub
            }
        });



    }

    public void father(View view){
        //设置妻子按钮true和丈夫按钮false
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(false);
        button_wife.setEnabled(true);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("爸爸");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("爷爷");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
            case "姑奶奶":
                textView_main.setText("曾祖父");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("高祖父");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("外公");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外曾祖父");
                break;
            case "外曾祖父":
                textView_main.setText("外高祖父");
                break;
            case "外婆":
                textView_main.setText("外曾外祖父");
                break;
            case "外曾外祖母":
                textView_main.setText("外曾外曾外祖父");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("姑爹");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻伯公");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("叔父");
                break;
            case "弟媳":
                textView_main.setText("弟眷父");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷父");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻父");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻父");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("兄弟");
                break;
            case "儿媳":
            case "女婿":
                textView_main.setText("亲家公");
                break;
            case "儿子":
            case "女儿":
                if(string_sex.equals("男")){
                    textView_main.setText("我");
                }
                else if(string_sex.equals("女")){
                    textView_main.setText("老公");
                }
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("儿子");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("女婿");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }






    }

    public void mather(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(true);
        button_wife.setEnabled(false);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("妈妈");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("奶奶");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
            case "姑奶奶":
                textView_main.setText("曾祖母");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("高祖母");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("外婆");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外曾祖母");
                break;
            case "外曾祖父":
                textView_main.setText("外高祖母");
                break;
            case "外婆":
            case "外舅公":
            case "外姨婆":
                textView_main.setText("外曾外祖母");
                break;
            case "外曾外祖母":
                textView_main.setText("外曾外曾外祖母");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("姑妈");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻伯母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("婶婶");
                break;
            case "弟媳":
                textView_main.setText("弟眷母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("弟媳或嫂子");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "儿媳":
            case "女婿":
                textView_main.setText("亲家母");
                break;
            case "儿子":
            case "女儿":
                if(string_sex.equals("男")){
                    textView_main.setText("老婆");
                }
                else if(string_sex.equals("女")){
                    textView_main.setText("我");
                }
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("儿媳");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("女儿");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }

    }

    public void ebrother(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(false);
        button_wife.setEnabled(true);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("哥哥");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("伯父");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
            case "姑奶奶":
                textView_main.setText("伯公");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("伯曾祖父");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("舅舅");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外伯公");
                break;
            case "外婆":
            case "外舅公":
            case "外姨婆":
                textView_main.setText("外舅公");
                break;
            case "外曾外祖母":
                textView_main.setText("外曾外曾外祖母");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("表兄弟");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻世伯");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("堂兄弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "弟媳":
                textView_main.setText("弟眷兄");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷兄");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻兄");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻兄");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("侄子");
                break;
            case "儿子":
            case "女儿":
                textView_main.setText("儿子");
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("孙子");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("外孙");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }
    }

    public void ybrother(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(false);
        button_wife.setEnabled(true);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("弟弟");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("叔父");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
            case "姑奶奶":
                textView_main.setText("叔公");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("叔曾祖父");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("舅舅");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外叔公");
                break;
            case "外婆":
            case "外舅公":
            case "外姨婆":
                textView_main.setText("外舅公");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("表兄弟");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻世伯");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("堂兄弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "弟媳":
                textView_main.setText("弟眷弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻弟");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("侄子");
                break;
            case "儿子":
            case "女儿":
                textView_main.setText("儿子");
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("孙子");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("外孙");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }
    }

    public void esister(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(true);
        button_wife.setEnabled(false);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("姐姐");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("姑妈");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
                textView_main.setText("姑奶奶");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("姑曾祖母");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("姨妈");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外姑婆");
                break;
            case "外婆":
            case "外舅公":
            case "外姨婆":
                textView_main.setText("外姨婆");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("表姐妹");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻伯母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("堂姐妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "弟媳":
                textView_main.setText("弟眷姊");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷姊");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻姊");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻姊");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("侄女");
                break;
            case "儿子":
            case "女儿":
                textView_main.setText("女儿");
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("孙女");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("外孙女");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }
    }

    public void ysister(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(true);
        button_wife.setEnabled(false);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        switch (main) {
            case " ":
            case "我":
            case "我或兄弟":
            case "我或姐妹":
            case "姐妹":
            case "姐姐":
            case "妹妹":
            case "兄弟":
            case "哥哥":
            case "弟弟":
                textView_main.setText("妹妹");
                break;
            case "爸爸":
            case "姑妈":
            case "叔父":
            case "伯父":
                textView_main.setText("姑妈");
                break;
            case "爷爷":
            case "叔公":
            case "伯公":
                textView_main.setText("姑奶奶");
                break;
            case "曾祖父":
            case "伯曾祖父":
            case "叔曾祖父":
            case "姑曾祖母":
                textView_main.setText("姑曾祖母");
                break;
            case "妈妈":
            case "舅舅":
            case "姨妈":
                textView_main.setText("姨妈");
                break;
            case "外公":
            case "外叔公":
            case "外伯公":
            case "外姑婆":
                textView_main.setText("外姑婆");
                break;
            case "外婆":
            case "外舅公":
            case "外姨婆":
                textView_main.setText("外姨婆");
                break;
            case "表兄弟":
            case "表姐妹":
                textView_main.setText("表姐妹");
                break;
            case "姑爹":
            case "婶婶":
            case "舅妈":
            case "姨爹":
                textView_main.setText("姻伯母");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "堂兄弟":
            case "堂姐妹":
                textView_main.setText("堂姐妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "弟媳":
                textView_main.setText("弟眷妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "嫂子":
                textView_main.setText("兄眷妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "妹夫":
                textView_main.setText("妹姻妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "姐夫":
                textView_main.setText("姊姻妹");
                Toast.makeText(MainActivity.this, "请重置以继续计算", Toast.LENGTH_LONG).show();
                break;
            case "侄子":
            case "侄女":
                textView_main.setText("侄女");
                break;
            case "儿子":
            case "女儿":
                textView_main.setText("女儿");
                break;
            case "孙子":
            case "孙女":
                textView_main.setText("孙女");
                break;
            case "外孙":
            case "外孙女":
                textView_main.setText("外孙女");
                break;
            default:
                Toast.makeText(MainActivity.this, "你是不是故意找茬儿啊！", Toast.LENGTH_LONG).show();
                break;
        }
    }

    public void husband(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(false);
        button_wife.setEnabled(true);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        if(main.equals(" ")||main.equals("我")){
            textView_main.setText("老公");
        }
    }

    public void wife(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(true);
        button_wife.setEnabled(false);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        if(main.equals(" ")||main.equals("我")){
            textView_main.setText("老婆");
        }
    }

    public void son(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(false);
        button_wife.setEnabled(true);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        if(main.equals(" ")||main.equals("我")){
            textView_main.setText("儿子");
        }
    }

    public void daughter(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);
        button_husband.setEnabled(true);
        button_wife.setEnabled(false);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        if(main.equals(" ")||main.equals("我")){
            textView_main.setText("女儿");
        }
    }

    public void clear(View view){
        Spinner spinner_sex=(Spinner)findViewById(R.id.spinner_sex);
        Button button_husband=(Button) findViewById(R.id.button_husband);
        Button button_wife=(Button) findViewById(R.id.button_wife);

        TextView textView_main=(TextView) findViewById(R.id.textView_main);
        String string_sex=spinner_sex.getSelectedItem().toString();
        String main=textView_main.getText().toString();

        textView_main.setText(" ");
        if(string_sex.equals("男")){
            button_husband.setEnabled(false);
            button_wife.setEnabled(true);
        }
        else if(string_sex.equals("女")){
            button_husband.setEnabled(true);
            button_wife.setEnabled(false);
        }
    }



}